package com.iot.ic.tcp.coder;


import com.iot.ic.tcp.model.MsgRequest;
import com.iot.ic.tcp.utils.ByteUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import net.sf.json.JSONArray;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class SendCustomDecoder extends MessageToMessageDecoder<ByteBuf> {

	private Logger logger = LoggerFactory.getLogger(SendCustomDecoder.class);

	@Override
	protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
		final byte []array;
		final int length=msg.readableBytes();
		array=new byte[length];
		msg.getBytes(msg.readerIndex(), array, 0, length);
		logger.info("上传数据"+Arrays.toString(ByteUtil.getHexString(array)));
		//out.add(parseMsg(array));
	}






	

}
